package com.cw.jeeyt.dao.impl.process;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.cw.jeeyt.common.Order;
import com.cw.jeeyt.dao.intf.process.ActReModelDao;
import com.cw.jeeyt.dao.mapper.process.ActReModelMapper;
import com.cw.jeeyt.dao.model.process.ActReModelDo;
import com.cw.lang.common.utils.PageUtil;
import com.cw.lang.common.pagehelper.PageHelper;
import com.cw.lang.mybatis.dto.PageInfo;

/**
 * dao数据库操作接口
 *
 * @author chenw
 * @date 2019-03-23 23:37:05
 */
@Repository
public class ActReModelDaoImpl implements ActReModelDao {
    @Autowired
    private ActReModelMapper actReModelMapper;

    /**
     * 新增
     *
     * @param actReModel
     * @return 整数
     */
    public Integer insert(ActReModelDo actReModel) {
        return actReModelMapper.insert(actReModel);
    }

    /**
     * 新增不为空的字段
     *
     * @param actReModel
     * @return 整数
     */
    public Integer insertSelective(ActReModelDo actReModel) {
        return actReModelMapper.insertSelective(actReModel);
    }

    /**
     * 删除
     *
     * @param actReModel
     */
    public void delete(ActReModelDo actReModel) {
        actReModelMapper.delete(actReModel);
    }

    /**
     * 修改不为null的字段
     *
     * @param actReModel
     */
    public void updateSelective(ActReModelDo actReModel) {
        actReModelMapper.updateSelective(actReModel);
    }

    /**
     * 修改
     *
     * @param actReModel
     */
    public void update(ActReModelDo actReModel) {
        actReModelMapper.update(actReModel);
    }

    /**
     * 根据主键查询
     *
     * @return
     */
    public ActReModelDo getById(String id_) {
        return actReModelMapper.getById(id_);
    }

    /**
     * 查询所有
     *
     * @return 集合
     */
    public List<ActReModelDo> queryActReModelList() {
        return actReModelMapper.queryActReModelList();
    }

    /**
     * 分页查询
     *
     * @param actReModel 查询条件
     * @param startNum 开始条数
     * @param pageSize 每页长度
     * @return 集合
     */
    public PageInfo<ActReModelDo> queryByPage(ActReModelDo actReModel, Integer startNum, Integer pageSize, Order order)
    {
        PageHelper.startPage(PageUtil.calPageNum(startNum, pageSize), pageSize);
        return new PageInfo<>(actReModelMapper.queryByPage(actReModel, order));
    }
}
